<CFPARAM NAME="componentid" DEFAULT="0">


<CFIF isdefined('form.Action')>
	<CFIF form.Action is "INSERT">
		
<CFQUERY name="addcomponents" datasource="#application.dsn#">
INSERT INTO components (
	name,
	ownerid

)
VALUES
(
	'#name#',
	 #ownerid#

)
</CFQUERY>

		<CFLOCATION url="components_list.cfm?msg=item has been added">
	
	<CFELSE>
	
	
		
<CFQUERY DATASOURCE="trac_fu" NAME="updatecomponents">
UPDATE components
SET 
name='#name#',
ownerid=#ownerid#

WHERE componentid=#componentid#
</CFQUERY>


		<CFLOCATION url="components_list.cfm?msg=item has been updated">
	
	</CFIF>
</CFIF>

<cfquery datasource="#application.dsn#" name="getcomponents">
SELECT * FROM components
WHERE componentid=#componentid#  
</cfquery>



<FORM action="components_frmaddedit.cfm" method="post" name="frmcomponents">

	<INPUT TYPE="hidden" NAME="componentid" value="<cfoutput>#componentid#</cfoutput>">

<table width="100%" cellspacing="0" cellpadding="0">


		<TR>
			<TD>name</TD>
			<TD><INPUT TYPE="TEXT" NAME="name" VALUE="<cfoutput>#getcomponents.name#</cfoutput>"  SIZE="75"></TD>
		</TR>

		<TR>
			<TD>ownerid</TD>
			<TD><INPUT TYPE="TEXT" NAME="ownerid" VALUE="<cfoutput>#getcomponents.ownerid#</cfoutput>"></TD>
		</TR>

	<TR>
		<TD colspan=2>
		<CFIF componentid IS NOT 0>
			<INPUT TYPE="HIDDEN" NAME="Action" VALUE="UPDATE">
			<INPUT TYPE="SUBMIT" VALUE=" UPDATE ">
		<CFELSE>
			<INPUT TYPE="HIDDEN" NAME="Action" VALUE="INSERT">
			<INPUT TYPE="SUBMIT" VALUE=" INSERT ">
		</CFIF>
		</TD>
	</TR>
</TABLE>

</FORM>
